
import request from '@/utils/request'

// 上传文档
export function uploadDocument(data) {
  return request({
    url: '/document/upload',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 获取用户文档列表
export function getDocumentList(params) {
  return request({
    url: '/document/list',
    method: 'get',
    params
  })
}

// 根据ID查询文档
export function getDocumentById(id) {
  return request({
    url: `/document/${id}`,
    method: 'get'
  })
}

// 删除文档
export function deleteDocument(id) {
  return request({
    url: `/document/${id}`,
    method: 'delete'
  })
}

// 提取文档内容
export function extractDocumentContent(id) {
  return request({
    url: `/document/${id}/extract`,
    method: 'post'
  })
}

// 下载文档
export function downloadDocument(id) {
  return request({
    url: `/document/${id}/download`,
    method: 'get',
    responseType: 'blob'
  })
}
